from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
import time
driver = webdriver.Chrome()
driver.maximize_window()
driver.get('https://www.bilibili.com')
driver.switch_to.frame(driver.find_element_by_tag_name("iframe")[3])
# 从当前页面切换到另外一个页面
driver.find_element_by_xpath("/html/body/div/div[1]/div[2]/a[1]").click()

# 点击某个元素链接
time.sleep(5)
driver.quit()